home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple WWDC 1996
/
WWDC96_1996 (CD).toast
/
Technology Materials
/
MacOS 8 Resources
/
Developer Tools
/
Mac OS 8 Interfaces & Libraries
/
Interfaces
/
IDLIncludes
/
ConditionalMacros.idl
< prev
next >
Wrap
Text File
|
1996-05-01
|
13KB
|
315 lines
/*
File: ConditionalMacros.idl
Contains: Set up for compiler independent conditionals
Version: Technology: Universal Interface Files 3.0dx
Release: Universal Interfaces 3.0d3 on Copland DR1
Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
Bugs?: If you find a problem with this file, send the file and version
information (from above) and the problem description to:
Internet: apple.bugs@applelink.apple.com
AppleLink: APPLE.BUGS
*/
#ifndef __CONDITIONALMACROS_IDL__
#define __CONDITIONALMACROS_IDL__
#include <somobj.idl>
#include <somcls.idl>
/*
***************************************************************************************************
UNIVERSAL_INTERFACES_VERSION
0x0300 => version 3.0
0x0210 => version 2.1
This conditional did not exist prior to version 2.1
***************************************************************************************************
*/
/*
***************************************************************************************************
GENERATINGPOWERPC - Compiler is generating PowerPC instructions
GENERATING68K - Compiler is generating 68k family instructions
Invariant:
GENERATINGPOWERPC != GENERATING68K
***************************************************************************************************
*/
#ifdef GENERATINGPOWERPC
#ifndef GENERATING68K
#define GENERATING68K !GENERATINGPOWERPC
#endif
#endif
#ifdef GENERATING68K
#ifndef GENERATINGPOWERPC
#define GENERATINGPOWERPC !GENERATING68K
#endif
#endif
#ifndef GENERATINGPOWERPC
#if defined(powerc) || defined(__powerc)
#define GENERATINGPOWERPC 1
#else
#define GENERATINGPOWERPC 0
#endif
#endif
#ifndef GENERATING68K
#if GENERATINGPOWERPC
#define GENERATING68K 0
#else
#define GENERATING68K 1
#endif
#endif
/*
***************************************************************************************************
GENERATING68881 - Compiler is generating mc68881 floating point instructions
Invariant:
GENERATING68881 => GENERATING68K
***************************************************************************************************
*/
#if GENERATING68K
#if defined(applec) || defined(__SC__)
#ifdef mc68881
#define GENERATING68881 1
#endif
#else
#ifdef __MWERKS__
#if __MC68881__
#define GENERATING68881 1
#endif
#endif
#endif
#endif
#ifndef GENERATING68881
#define GENERATING68881 0
#endif
/*
***************************************************************************************************
GENERATINGCFM - Code being generated assumes CFM calling conventions
CFMSYSTEMCALLS - No A-traps. Systems calls are made using CFM and UPP's
Invariants:
GENERATINGPOWERPC => GENERATINGCFM
GENERATINGPOWERPC => CFMSYSTEMCALLS
CFMSYSTEMCALLS => GENERATINGCFM
***************************************************************************************************
*/
#if GENERATINGPOWERPC || defined(__CFM68K__)
#define GENERATINGCFM 1
#define CFMSYSTEMCALLS 1
#else
#define GENERATINGCFM 0
#define CFMSYSTEMCALLS 0
#endif
/*
***************************************************************************************************
One or none of the following BUILDING_~= conditionals is expected to be set during
compilation (e.g. MrC -d BUILDING_FOR_SYSTEM7), the others should be left undefined.
If none is set, BUILDING_FOR_SYSTEM7_AND_SYSTEM8 is used.
BUILDING_FOR_SYSTEM7 - Code is intended to run on System 7.x machine or earlier .
BUILDING_FOR_SYSTEM7_AND_SYSTEM8 - Code is intended to run on System 7 or Copland.
BUILDING_FOR_SYSTEM8 - Code is intended to run on Copland only.
BUILDING_PREEMPTIVE_CODE - Code is intended to run as Copland server or driver.
The following conditionals are set up based on which of the BUILDING_~= flag (above) was specified.
They are used in throughout the interface files to conditionalize declarations.
FOR_SYSTEM7_ONLY - In System 7. Not in Copland.
FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED - In System 7. Works in Copland, but there is a better way.
FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE - In System 7. In Copland, but only for cooperative tasks.
FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE - In System 7. In Copland.
FOR_SYSTEM8_COOPERATIVE - Not in System 7. In Copland, but only for cooperative tasks.
FOR_SYSTEM8_PREEMPTIVE - Not in System 7. In Copland.
FOR_OPAQUE_SYSTEM_DATA_STRUCTURES - Always true for system 8, but can be set by developer to
true or false for System 7. When true, the contents of
many system data structures are removed from the interfaces.
In the future, the Mac OS will have fewer data structures
shared between applications and the system. The problem
with shared data is 1) the system has to poll the data
to detect changes made by an application, 2) it prevents
data structures from being changed in the future.
Procedural interface will be used instead.
FOR_PTR_BASED_AE - This is a temporary fix for Copland DR1. It is needed to
distinguish between pointer based and handle based AppleEvents.
If you are in the case of BUILDING_FOR_SYSTEM7_AND_SYSTEM8
and want to use new pointer base AppleEvents, you will need to
-d FOR_PTR_BASED_AE on your compiler command line.
***************************************************************************************************
*/
#if 0
/* extra if statement is to work around a bug in PPCAsm 1.2a2 */
#elif defined(BUILDING_FOR_SYSTEM7)
#ifndef FOR_OPAQUE_SYSTEM_DATA_STRUCTURES
#define FOR_OPAQUE_SYSTEM_DATA_STRUCTURES 0
#endif
#define FOR_PTR_BASED_AE 0
#define FOR_SYSTEM7_ONLY 1
#define FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED 1
#define FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE 1
#define FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE 1
#define FOR_SYSTEM8_COOPERATIVE 0
#define FOR_SYSTEM8_PREEMPTIVE 0
#elif defined(BUILDING_FOR_SYSTEM7_AND_SYSTEM8)
#ifndef FOR_OPAQUE_SYSTEM_DATA_STRUCTURES
#define FOR_OPAQUE_SYSTEM_DATA_STRUCTURES 1
#endif
#ifndef FOR_PTR_BASED_AE
#define FOR_PTR_BASED_AE 0
#endif
#define FOR_SYSTEM7_ONLY 0
#define FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED 1
#define FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE 1
#define FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE 1
#define FOR_SYSTEM8_COOPERATIVE 1
#define FOR_SYSTEM8_PREEMPTIVE 1
#elif defined(BUILDING_FOR_SYSTEM7_AND_SYSTEM)
/* xlc has a limit of 31 chars for command line defines, so redefine above clipped to 31 chars */
#ifndef FOR_OPAQUE_SYSTEM_DATA_STRUCTURES
#define FOR_OPAQUE_SYSTEM_DATA_STRUCTURES 1
#endif
#ifndef FOR_PTR_BASED_AE
#define FOR_PTR_BASED_AE 0
#endif
#define FOR_SYSTEM7_ONLY 0
#define FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED 1
#define FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE 1
#define FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE 1
#define FOR_SYSTEM8_COOPERATIVE 1
#define FOR_SYSTEM8_PREEMPTIVE 1
#elif defined(BUILDING_FOR_SYSTEM8)
#define FOR_OPAQUE_SYSTEM_DATA_STRUCTURES 1
#define FOR_PTR_BASED_AE 1
#define FOR_SYSTEM7_ONLY 0
#define FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED 0
#define FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE 1
#define FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE 1
#define FOR_SYSTEM8_COOPERATIVE 1
#define FOR_SYSTEM8_PREEMPTIVE 1
#elif defined(BUILDING_PREEMPTIVE_CODE)
#define FOR_OPAQUE_SYSTEM_DATA_STRUCTURES 1
#define FOR_PTR_BASED_AE 1
#define FOR_SYSTEM7_ONLY 0
#define FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED 0
#define FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE 0
#define FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE 1
#define FOR_SYSTEM8_COOPERATIVE 0
#define FOR_SYSTEM8_PREEMPTIVE 1
#else
/* default is BUILDING_FOR_SYSTEM7_AND_SYSTEM8 */
#define FOR_OPAQUE_SYSTEM_DATA_STRUCTURES 1
#ifndef FOR_PTR_BASED_AE
#define FOR_PTR_BASED_AE 0
#endif
#define FOR_SYSTEM7_ONLY 0
#define FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED 1
#define FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE 1
#define FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE 1
#define FOR_SYSTEM8_COOPERATIVE 1
#define FOR_SYSTEM8_PREEMPTIVE 1
#endif
/*
***************************************************************************************************
OLDROUTINENAMES - "Old" names for Macintosh system calls are allowed in source code.
(e.g. DisposPtr instead of DisposePtr). The names of system routine
are now more sensitive to change because CFM binds by name. In the
past, system routine names were compiled out to just an A-Trap.
Macros have been added that each map an old name to its new name.
This allows old routine names to be used in existing source files,
but the macros only work if OLDROUTINENAMES is true. This support
will be removed in the near future. Thus, all source code should
be changed to use the new names! You can set OLDROUTINENAMES to false
to see if your code has any old names left in it.
OLDROUTINELOCATIONS - "Old" location of Macintosh system calls are used. For example, c2pstr
has been moved from Strings to TextUtils. It is conditionalized in
Strings with OLDROUTINELOCATIONS and in TextUtils with !OLDROUTINELOCATIONS.
This allows developers to upgrade to newer interface files without suddenly
all their code not compiling becuase of "incorrect" includes. But, it
allows the slow migration of system calls to more understandable file
locations. OLDROUTINELOCATIONS currently defaults to true, but eventually
will default to false.
***************************************************************************************************
*/
#ifndef OLDROUTINENAMES
#define OLDROUTINENAMES 0
#endif
#ifndef OLDROUTINELOCATIONS
#define OLDROUTINELOCATIONS 0
#endif
/*
***************************************************************************************************
C specific conditionals
CGLUESUPPORTED - Interface library will support "C glue" functions (function names
are: all lowercase, use C strings instead of pascal strings, use
Point* instead of Point).
PRAGMA_ALIGN_SUPPORTED - Compiler supports "#pragma align=..." directives. The only compilers that
can get by without supporting the pragma are old classic 68K compilers
that will only be used to compile older structs that have 68K alignment
anyways.
PRAGMA_IMPORT_SUPPORTED - Compiler supports "#pragma import on/off" directives. These directives
were introduced with the SC compiler which supports CFM 68K. The directive
is used to tell the compiler which functions will be called through a
transition vector (instead of a simple PC-relative offset). This allows
the compiler to generate better code. Since System Software functions are
implemented as shared libraries and called through transition vectors,
all System Software functions are declared with "#pragma import on".
Invariants:
PRAGMA_IMPORT_SUPPORTED => CFMSYSTEMCALLS
GENERATINGPOWERPC => PRAGMA_ALIGN_SUPPORTED
***************************************************************************************************
*/
#ifndef CGLUESUPPORTED
#ifdef THINK_C
#define CGLUESUPPORTED 0
#else
#define CGLUESUPPORTED 1
#endif
#endif
/*
All PowerPC compilers support pragma align
For 68K, only Metrowerks and SC 8.0 support pragma align
*/
/* Currently, only Metowerks CW7 and later, and SC 8.0 or later support pragma import */
/*
***************************************************************************************************
Set up old "USES..." conditionals to support 1.0 universal interface files
The USESxxx names are old, but cannot be removed yet because source code that
uses them might still compile, but do the wrong thing.
***************************************************************************************************
*/
#ifndef USES68KINLINES
#define USES68KINLINES GENERATING68K
#endif
#define USESCODEFRAGMENTS GENERATINGCFM
#define USESROUTINEDESCRIPTORS GENERATINGCFM
/*
***************************************************************************************************
The following macros isolate the use of inlines from the routine prototypes.
A routine prototype will always be followed by on of these inline macros with
a list of the opcodes to be inlined. On the 68K side, the appropriate inline
code will be generated. On platforms that use code fragments, the macros are
essentially NOPs.
***************************************************************************************************
*/
#if CFMSYSTEMCALLS
#else
#endif
#endif /* __CONDITIONALMACROS_IDL__ */